﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 通用违章性质管理
/// </summary>
[Route("QHSEXyGeneralViolation/[action]")]
[ApiController]

public class QHSEXyGeneralViolationController : ControllerBase
{
    private readonly QHSEXyGeneralViolationService _generalViolationService;

    public QHSEXyGeneralViolationController(QHSEXyGeneralViolationService generalViolationService)
    {
        _generalViolationService = generalViolationService;
    }

    /// <summary>
    /// 通用违章性质列表
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSEXyGeneralViolationModel> data = await _generalViolationService.GetAsync();
        return AppResult.Status200OK(data: data);
    }

    /// <summary>
    /// 通用违章条款查询
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> ClausePage([FromQuery] GeneralViolationInputModel input)
    {
        PageResultModel<QHSEXyGeneralViolationModel> data = await _generalViolationService.QueryByViolationTypeCodeAsync(input);
        return AppResult.Status200OK(data: data);
    }

}

